<template>
	<view class="w100">
		<img src="../../static/img/sharebg.jpg" class="w100 h100" />
		<!-- <image src="../../static/img/sharebg.jpg" class="w100 h100"  mode="aspectFill"></image> -->
		<view class="btnshowimg">
			<span class="col_red bg_white" @click="showshare()">分享赚积分</span>
		</view>
		
		
		<view class="w100 tRight sharewindow" v-if="sharein" @click="hideshare()">
			<img class="w60 pR10" src="../../static/img/share.png" ></img>
		</view>
	</view>
</template>

<script>
	import {userinfo} from '@/common/api/user.js';
	import {wexinshare} from '@/common/wechatshare.js';
	export default {
		data() {
			return {
				sharein:false,
			}
		},
		onLoad(event) {	
			this.showdata()
		},
		methods: {
			showshare(){
				this.sharein=true;
			},
			hideshare(){
				this.sharein=false;
			},
			showdata(){
				userinfo({}).then(resuser=>{//获取用户信息
					this.userinfodata=resuser.data.data;	
						// 生成分享
						let username=uni.getStorageSync('username');
						var title="邀请有礼";
						let desccontent=resuser.data.data.name+"邀请您加入";
						var url=this.weixinhttpurl+'/#/pages/user/user?&sharecode='+this.userinfodata.sharecode;
						// var img='https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2267186809,1206764244&fm=26&gp=0.jpg';
						var sharedata={
							title:title,
							desc:desccontent,
							img:this.sharehttpurl+'/static/images/yao.jpg?123',
							link:url
						}
						
						wexinshare(sharedata)//微信分享
									
				})
			}
		}
	}
</script>

<style scoped>
	.sharewindow{position:fixed;z-index: 999; top: 0px;right: 0;height: 100%;background-color: rgba(0,0,0,0.4);}
	.btnshowimg{position: absolute;top: 550rpx;left: 0; width: 100%;text-align: center;}
	.btnshowimg span{border: 1px solid red;border-radius: 10px;display: block; width: 50%;line-height: 40px;margin: 0 auto;}
	
</style>
